package com.eims.sls_app.ui;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.Html;
import android.text.Spanned;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.Button;
import android.widget.TextView;

import bls.juejin.cn.R;
import com.eims.sls_app.utils.App;
import com.eims.sls_app.utils.AppTools;

public class RegiesterSuccessActivity extends MyBaseActivity implements
		OnClickListener {
	private static final String TAG = "PaySuccessActivity";
	private Context context = RegiesterSuccessActivity.this;
	private TextView tv_tip;// 提示
	private Button btn_perfectinfo;// 完善资料
	private Button btn_goto_recharge;// 我要充值
	private Button btn_back_tohall;// 返回首页

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		this.requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.activity_regiestersuc);
		App.activityS.add(this);
		findView();
		setListener();
		init();
	}

	public void findView() {
		tv_tip = (TextView) findViewById(R.id.tv_tip);
		btn_perfectinfo = (Button) findViewById(R.id.btn_perfectinfo);
		btn_goto_recharge = (Button) findViewById(R.id.btn_goto_recharge);
		btn_back_tohall = (Button) findViewById(R.id.btn_back_tohall);
	}

	public void setListener() {
		btn_perfectinfo.setOnClickListener(this);
		btn_goto_recharge.setOnClickListener(this);
		btn_back_tohall.setOnClickListener(this);
	}

	public void init() {
		Spanned text = Html.fromHtml("您共花费 "
				+ AppTools.changeStringColor("#e3393c", 1 + "") + " 元，余额为 "
				+ AppTools.changeStringColor("#e3393c", "11") + " 元");
		tv_tip.setText(text);
	}

	@Override
	public void onClick(View v) {
		int id = v.getId();
		switch (id) {
		case R.id.btn_perfectinfo:// 完善资料
			Intent intent = new Intent(context,
					AccountInformationActivity.class);
			context.startActivity(intent);
			finish();
			break;
		case R.id.btn_goto_recharge:// 我要充值
			Intent intent1 = new Intent(context,
					SelectRechargeTypeActivity.class);
			context.startActivity(intent1);
			finish();
			break;
		case R.id.btn_back_tohall:// 返回首页
			backToHall();
			break;
		}
	}

	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		if (keyCode == KeyEvent.KEYCODE_BACK) {
			// 返回个人中心
		}
		return super.onKeyDown(keyCode, event);
	}

	/**
	 * 返回首页
	 */
	public void backToHall() {
		Intent intent = new Intent(getApplicationContext(), MainActivity.class);
		this.startActivity(intent);
		this.finish();
	}

}
